1. Field of the Invention
The present invention relates to a task tracing apparatus that records a history of task execution in a multitask operating system.
2. Description of the Prior Art
FIG. 1 is a basic block diagram of a multitask operating system such as one described in "Analyzing Multitask" (2nd ed., CQ Publications Inc., Tokyo, 1988, p. 18) by S. Sasaki. In the figure, each reference numeral 1 is an application task; numeral 2 is a supervisor that manages and controls the application tasks 1; numeral 3 is a memory management unit that manages the memory area for the application tasks 1; numeral 4 is a data management unit that manages input/output data of the application tasks 1; numeral 5 is a process management unit that manages multitasking operations; and numeral 6 is an input/output management unit that manages and controls I/O devices installed in the system. The components 1 through 6 combine to form an operating system called a kernel 7.
FIG. 2 is a block diagram of a prior art process management routine which is illustrated in "Analyzing Multitask" (ibid., p. 48) and which is part of the operating system described therein. In the figure, reference numeral 2 is the supervisor which supervises external interrupt requests from the outside and system calls issued from programs; numeral 5 is a routine that manages the process; numeral 11 is a synchronization control unit for synchronizing with I/O devices; numeral 12 is a process scheduler that generates a task queue in accordance with the priorities of the tasks involved; numeral 13 is a process list that contains the tasks in the queue; and numeral 14 is a process switcher that assigns the CPU to the highest-priority task in the task queue. FIG. 3 shows a configuration of hardware that embodies the apparatus mentioned above.
What follows is a description of how a task switch takes place. There are three causes of the task switch: an externally generated interruption, all I/O synchronization interruption, and a system call. Externally generated interruptions include those from outside the system and those from outside the CPU such as a monitoring timer interruption. I/O synchronization interruptions are generated to synchronize the CPU with peripheral devices having different operation speeds, such as floppy disk drives, printers, magnetic tape units and hard disk drives. Any of these three causes, when taking place, can trigger a task switch.
FIG. 4(a) through FIG. 4(c) depict examples of the three kinds of task switching taking place as a result of their respective causes. FIG. 4(a) shows an example of how a task switch occurs in the case of an externally generated interruption. The interruption occurs while task A is being executed. This causes task B, so far in a wait state, to change into a ready state. Now both task A and task B are in a ready state. If the priority of task B is higher than that of task A, the CPU is assigned to task B. FIG. 4(b) is an example of an I/O synchronization interruption triggering a task switch. Task B, while being executed, requests a peripheral device to perform a certain process. Then task B enters a wait state and remains therein until the device completes its process. With task B in its wait state, the CPU is assigned to task A which has been in a ready state but which has been inactive because of its priority being lower than that of task B. When the peripheral device has completed its process, an I/O synchronization interruption takes place. This causes task B to change from its wait state into a ready state. Thus a task switch from task A to task B occurs. FIG. 4(c) is an example of how a system call triggers a task switch. Task A is being executed while task B is in a wait state. Then task A issues a system call that causes task B to change from its wait state into a ready state. If the priority of task B is higher than that of task A, a task switch takes place from task A to task B.
Referring now to FIG. 5, there will be described the operations carried out when a task switch is caused by an I/O synchronization interruption. In step ST1, an I/O interruption occurs. In step ST2, the occurrence of the interruption is reported via the synchronization control unit 11 to the supervisor 2 and process scheduler 12. In step ST3, the process scheduler 12 puts into a ready state a task that has waited for I/O processing, and enters the task in the process list 13. In step ST4, the supervisor 2 notifies the process switcher 14 to switch to the new task. In step ST5, the process switcher 14 gets from the process list 13 the information about the task to which a switch is to be made. In step ST6, the information is set in registers or similar storage devices means of the CPU. With the information about the new task established in this manner, the task switch takes place.
Referring now to FIG. 6, there will be described the operations performed when a task switch is triggered by a system call or by an interruption. In step ST11, a system call or an interruption takes place, calling for a task switch. In step ST12, the supervisor 2 is notified of the occurrence thereof. In step ST13, the supervisor 2 notifies the process switcher 14 of a task switch. In step ST14, the process switcher 14 gets from the process list 13 the information about the task to be switched over. In step ST15, the information is set in registers or similar storage devices of the CPU. The task switch then takes place.
Where it is necessary to develop multitask software which requires repeatedly performing the task switches described above while in operation, there are cases in which a task tracing apparatus is used to trace the history of such task switches. What follows is a description of how task tracing is carried out. The process switcher in the process management routine records task switches for task tracing purposes. These records constitute information collected only by the process switcher. The information only contains task switching from one task to another. In reference to FIG. 7, task tracing in a prior art setup takes place as follows. In step ST21, the task tracing is initiated with an operator interface device such as a CRT. In step ST22, the process switcher is notified of the task tracing being activated. Upon a task switch, in step ST23, the process switcher collects information about the task switch from which task to which task. In step ST24, the collected information is placed consecutively in a tracing buffer. In step ST25, the operator interface device requests that the contents of the tracing buffer be outputted to an appropriate output device (CRT, etc.). In step ST26, the contents of the tracing buffer are illustratively displayed on the CRT. In developing software, the software designer in charge checks if the task switches are performed as designed based on the information that is outputted in this manner.
The typical prior art task tracing apparatus operation has been described above. As can be seen, the history of task execution, i.e., the history of task switches from one task to another, is collected as trace information. The trouble is that with the prior art apparatus, it has been impossible to know which task stopped the ongoing task execution for what reason, and which task resumed it and why. Given these unknown factors, it has taken many hours to find out the cause of an unexpected task switch. This has resulted in the need to take an inordinate amount of time to develop multitask systems.